package com.quasar.hpatient.module.comm_guide;

import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.quasar.hpatient.R;

/**
 * description: 向导页面
 * created by kalu on 2018/4/4 10:21
 */
final class GuideAdapter extends PagerAdapter {

    private final int[] imageList = new int[]{
            R.drawable.ic_comm_guide1,
            R.drawable.ic_comm_guide2,
            R.drawable.ic_comm_guide3,
            R.drawable.ic_comm_guide4
    };

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        final ImageView image = new ImageView(container.getContext());
        image.setScaleType(ImageView.ScaleType.CENTER_CROP);
        image.setImageResource(imageList[position]);
        container.addView(image);
        return image;
    }

    @Override
    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
        super.destroyItem(container, position, object);
    }
}